package thread;

public class SyncDemo3 {
    public static void main(String[] args) {

        Thread t1 = new Thread(){
            public void run() {
                Boo.doSome();
            }
        };
        Thread t2 = new Thread(){
            public void run() {
                Boo.doSome();
            }
        };
        t1.start();
        t2.start();

    }

}
class Boo{
    public static void doSome(){
        synchronized(Boo.class){
        Thread t = Thread.currentThread();
        System.out.println(t.getName()+"zhengzaizhixing doSome");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(t.getName()+"zhixing doSome wanbi");
        }
    }
}
